package com.ysstech.reportworld.enums;

import com.ysstech.common.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
 * 系统常量
 *
 * @author lsl
 */
@Getter
@AllArgsConstructor
public enum ReportWorldStandardCheckTableCodeEnum implements BaseEnum<String> {
    LAYERED("LAYERED", "按照表分层"),
    // FTYPE("FTYPE", "按照表类型"),
    //  FSOURCE("FSOURCE", "按照表来源"),
    CUSTOMER("CUSTOMER", "按照客户编码"),
    REPORT("REPORT", "按照报表编码"),
    MODULAR("MODULAR", "按照模块编码");

    private final String code;
    private final String desc;

    public static ReportWorldStandardCheckTableCodeEnum getEnum(String code) {
        return Arrays.stream(values()).filter(b -> Objects.equals(b.code, code)).findFirst().orElse(null);
    }

    public static String getEnumDesc(String code) {
        ReportWorldStandardCheckTableCodeEnum e = getEnum(code);
        return e != null ? e.desc : null;
    }

    /**
     * @return
     */
    public static List<String> getReportWorldStandardCheckTableEnum() {
        List<String> list = new ArrayList<>();
        for (ReportWorldStandardCheckTableCodeEnum tableEnum : ReportWorldStandardCheckTableCodeEnum.values()) {
            if (null == tableEnum) {
                continue;
            }
            list.add(tableEnum.getCode());
        }
        return list;

    }
}
